package com.itany.corejava.entity;

import com.itany.corejava.code17_设计模式.工厂模式.ObjectFactory;

import java.util.Date;

/**
 * @author MissChen
 * @date 2024年03月28日 9:46
 */
public class User {
    private Integer id;
    private String username;
    private String password;
    private String phone;
    // 在User中使用其他由工厂创建的对象时
    // 其加载时机必须比User要早
    private Address address= (Address) ObjectFactory.getObject("address");
    private Date birthday= (Date) ObjectFactory.getObject("date");

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", phone='" + phone + '\'' +
                ", address=" + address +
                ", birthday=" + birthday +
                '}';
    }
}
